<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<HTML>
<HEAD>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<%-- <link href="${pageContext.request.contextPath}/css/Style1.css"
	rel="stylesheet" type="text/css" />
<script type="text/javascript"
	src="${ pageContext.request.contextPath }/static/js/jquery-2.1.1.min.js"></script>
<!-- 引入样式 -->
<script language="javascript"
	src="${pageContext.request.contextPath}/js/public.js"></script> --%>

<link href="${pageContext.request.contextPath}/css/Style1.css"
	rel="stylesheet" type="text/css" />
<link
	href="${ pageContext.request.contextPath }/static/bootstrap-3.3.7-dist/css/bootstrap.min.css"
	rel="stylesheet">

<script type="text/javascript">

function selDetails(oid){
	window.location.href = "${pageContext.request.contextPath}/admin/orderDetails.action?oid="+oid;
}
	
function look(pid) {
	window.location.href = "${pageContext.request.contextPath}/order/list.jsp";
}
</script>
</HEAD>
<body>
	<br>
	<div>
		<div style="float: left;">
			<form
				action="${pageContext.request.contextPath}/admin/selectorderByPrimaryKey.action">
				<table>
					<tr>
						<td style="padding-left: 600px;"><input type="text"
							name="oid" id="oid" placeholder="订单编号" style="height: 28px;" /></td>
						<td width="20"></td>
						<td><button type="submit"
								class="btn btn-primary btn-sm glyphicon glyphicon-search"
								onclick="validate()"></button></td>
					</tr>
				</table>
			</form>
		</div>

		<div align="right" style="margin-right: 50px; padding-bottom: 10px;">
			<button type="button" value="已完成订单" style="height: 36px;"
				class="btn btn-primary btn-sm">
				<a style="color: white;"
					href="${pageContext.request.contextPath}/admin/adminOrder_findByState.action?page=1&state=3">已完成订单</a>
			</button>
			&nbsp;&nbsp;&nbsp;
			<button type="button" value="已发货订单" style="height: 36px;"
				class="btn btn-primary btn-sm">
				<a style="color: white;"
					href="${pageContext.request.contextPath}/admin/adminOrder_findByState.action?page=1&state=2">已发货订单</a>
			</button>
		</div>
	</div>


	<div>
		<form id="Form1" name="Form1"
			action="${pageContext.request.contextPath}/order/list.jsp"
			method="post">
			<table style="width: 100%" align="center" border="0">
				<TBODY>
					<tr>
						<td class="ta_01" align="center">
							<table width="97%" align="center" class="table-bordered"
								id="table" style="border: 1px solid #D0D0D0">
								<tr align="center" bgcolor="#93b6bd" height="40px;">
									<td align="center" width="5%">序号</td>
									<td align="center" width="5%">订单编号</td>
									<td align="center" width="8%">订单金额</td>
									<td align="center" width="8%">收货人</td>
									<td align="center" width="10%">收货地址</td>
									<td align="center" width="8%">订单状态</td>
									<td align="center" width="40%">订单详情</td>
									<td align="center" width="16%">操作</td>
								</tr>

								<c:forEach items="${pageBean.list}" var="o" varStatus="status">
									<tr onclick="selDetails(${o.oid})">
										<td style="CURSOR: hand; HEIGHT: 40px" align="center"
											width="5%">${status.count}</td>
										<td style="CURSOR: hand; HEIGHT: 22px" align="center"
											width="5%">${o.oid}</td>
										<td style="CURSOR: hand; HEIGHT: 22px" align="center"
											width="5%">${o.money}</td>
										<td style="CURSOR: hand; HEIGHT: 22px" align="center"
											width="8%">${o.accepter}</td>
										<td style="CURSOR: hand; HEIGHT: 22px" align="center"
											width="15%">${o.receiveinfo}</td>

										<td style="CURSOR: hand; HEIGHT: 22px" align="center"
											width="10%"><c:if test="${o.state==0}">
													未付款
												</c:if> <c:if test="${o.state==1}">
													已付款，
											<a
													href="${ pageContext.request.contextPath }/admin/adminOrder_updateState.action?oid=${o.oid}&status=2">
													<button type="button" class="btn btn-warning btn-sm">发货</button>
												</a>

											</c:if> <c:if test="${o.state==2}">
													等待确认收货
												</c:if> <c:if test="${o.state==3}">
													订单完成
												</c:if></td>
										<td align="center" style="HEIGHT: 22px">
											<div id="div${o.oid}">
												<table width="100%">
													<c:forEach items="${o.oiList}" var="orderItem">
														<tr>
															<td><img width="40" height="45"
																src="${ pageContext.request.contextPath }/${orderItem.product.image}"></td>
															<td>商品名称：${orderItem.product.pname}</td>
															<td>商品数量：${orderItem.count}</td>
															<td>商品总价：${orderItem.subtotal}</td>
														</tr>
													</c:forEach>
												</table>
											</div>
										</td>
										<td align="center"><button type="button"
												class="btn btn-success btn-sm glyphicon glyphicon-asterisk"
												onclick="look(${p.pid})"></button></td>
									</tr>
								</c:forEach>
							</table>
						</td>
					</tr>
					<tr align="center">
						<td colspan="7">第${pageBean.page}/${pageBean.totlePage}页 <c:if
								test="${pageBean.page != 1}">
								<a
									href="${ pageContext.request.contextPath }/admin/adminOrder_findAllByPage.action?page=1">首页</a>|
								<a
									href="${ pageContext.request.contextPath }/admin/adminOrder_findAllByPage.action?page=${pageBean.page-1}">上一页</a>|
							</c:if> <c:if test="${pageBean.page != pageBean.totlePage}">
								<a
									href="${ pageContext.request.contextPath }/admin/adminOrder_findAllByPage.action?page=${pageBean.page+1}">下一页</a>|
								<a
									href="${ pageContext.request.contextPath }/admin/adminOrder_findAllByPage.action?page=${pageBean.totlePage}">尾页</a>|
							</c:if>
						</td>
					</tr>
				</TBODY>
			</table>
		</form>
	</div>
</body>
</HTML>

